package com.wkbb.basic.thread;

import com.wkbb.basic.feign.DoorFeignService;
import lombok.extern.slf4j.Slf4j;

/**
 * @author yangdaofang
 * 创建时间：2020-01-10 15:02
 */
@Slf4j
public class SynDeviceTask implements Runnable{
    private DoorFeignService doorFeignService;
    private Long orgId;
    private String oriDeviceCode;
    private String newDeviceCode;
    private String deviceName;
    private String deviceVersion;
    private Short scene;
    private boolean isDel;

    public SynDeviceTask() {
    }

    public SynDeviceTask(DoorFeignService doorFeignService, Long orgId, String oriDeviceCode,
                         String newDeviceCode, String deviceName, String deviceVersion, Short scene, boolean isDel) {
        this.doorFeignService = doorFeignService;
        this.orgId = orgId;
        this.oriDeviceCode = oriDeviceCode;
        this.newDeviceCode = newDeviceCode;
        this.deviceName = deviceName;
        this.deviceVersion = deviceVersion;
        this.scene = scene;
        this.isDel = isDel;
    }

    @Override
    public void run() {
        try {
            log.info("进入同步设备信息到门禁.....start，orgId:{},oriDeviceCode:{},newDeviceCode:{},deviceName:{},deviceVersion:{},scene:{},isDel:{}",
                    orgId, oriDeviceCode, newDeviceCode, deviceName, deviceVersion, scene, isDel);
            Thread.sleep(1000);
            doorFeignService.synDeviceToDoor(orgId, oriDeviceCode, newDeviceCode, deviceName, deviceVersion, scene, isDel);
            log.info("进入同步设备信息到门禁.....end");
        } catch (Exception e) {
            log.error("同步设备信息到门禁异常,{}",e);
            e.printStackTrace();
        }
    }
}
